﻿using System;
using fastCSharp;

namespace diantou.web.user
{
    /// <summary>
    /// 用户的回答
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPool = true, IsReferer = false)]
    partial class answer : view<answer>
    {
        /// <summary>
        /// 用户回答集合
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private web.answer.userAnswer[] answers;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="page"></param>
        /// <param name="sort"></param>
        /// <param name="isAsc"></param>
        /// <returns></returns>
        private bool loadView(int userId, int page, diantou.dataAccess.answer.sort sort, bool isAsc)
        {
            if (base.loadView(userId))
            {
                diantou.dataAccess.answer[] values = diantou.dataAccess.tcpCall.answer.userAnswers(userId, sort, isAsc, pageInfo.Size = fastCSharp.config.pub.Default.PageSize, pageInfo.Page = page, currentUserId, out pageInfo.Count);
                answers = values.getArray(value => new web.answer.userAnswer { Answer = value, UserId = currentUserId });
                if (requestHeader.IsSearchEngine) pageInfo.Path = user.Path.Answer.ToPageString();
                return true;
            }
            return false;
        }
    }
}
